//
//  HomeView.m
//  JunZeWristband
//
//  Created by Kendama on 2017/8/17.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "HomeView.h"

@implementation HomeView



- (void)masLayoutSubview
{
    __weak UIView *superView = self;
    [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top);
        make.left.right.mas_equalTo(superView);
        make.height.mas_equalTo(px1920Height(648));
    }];
    
    [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.cycleScrollView.mas_bottom).with.offset(px1920Height(-80));
        make.left.right.mas_equalTo(superView);
        make.bottom.mas_equalTo(superView.mas_bottom);
    }];
    
    [self.meetButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(superView.mas_bottom).with.offset(px1920Height(-47));
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.left.mas_equalTo(superView.mas_left).with.offset(px1080Width(292));
        make.right.mas_equalTo(superView.mas_right).with.offset(px1080Width(-292));
        make.height.mas_equalTo(px1920Height(115));
    }];
    
    [self.wristbandView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.cycleScrollView.mas_bottom).with.offset(px1920Height(180));
        make.left.mas_equalTo(superView.mas_left).with.offset(px1080Width(140));
        make.right.mas_equalTo(superView.mas_right).with.offset(px1080Width(-140));
        make.height.mas_equalTo(px1920Height(190));
    }];
    
    [self.otherView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.wristbandView.mas_bottom).with.offset(px1920Height(29));
        make.left.mas_equalTo(superView.mas_left).with.offset(px1080Width(140));
        make.right.mas_equalTo(superView.mas_right).with.offset(px1080Width(-140));
        make.height.mas_equalTo(px1920Height(190));
    }];
}

- (SDCycleScrollView *)cycleScrollView
{
    if(!_cycleScrollView)
    {
        UIView *superView = self;
        _cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, 0, 0) delegate:nil placeholderImage:[UIImage imageNamed:@"banner"]];
        _cycleScrollView.localizationImageNamesGroup = @[@"banner", @"banner",@"banner"];
        _cycleScrollView.autoScrollTimeInterval = 5.;// 自动滚动时间间隔
        _cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;// 翻页 右下角
        _cycleScrollView.pageDotImage = [UIImage imageNamed:@"pageDotImage"];
        _cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"currentPageDotImage"];
        [superView addSubview:_cycleScrollView];
    }
    return _cycleScrollView;
}

- (UIImageView *)bgImageView
{
    if(!_bgImageView)
    {
        UIView *superView = self;
        _bgImageView = [[UIImageView alloc]init];
        [superView addSubview:_bgImageView];
        _bgImageView.image = [UIImage imageNamed:@"bg"];
    }
    return _bgImageView;
}

- (UIButton *)meetButton
{
    if(!_meetButton)
    {
        UIView *superView = self;
        _meetButton = [[UIButton alloc]init];
        [superView addSubview:_meetButton];
        [_meetButton setTitle:MyNSLocalizedString(@"认识巡洋实业") forState:UIControlStateNormal];
        [_meetButton setTitleColor:[UIColor colorWithHexString:@"F06161"] forState:UIControlStateNormal];
        [_meetButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
        _meetButton.layer.cornerRadius = 5;
        _meetButton.layer.borderColor = [UIColor colorWithHexString:@"F06161"].CGColor;
        _meetButton.layer.borderWidth = 1;
    }
    return _meetButton;
}

- (HomeButtonView *)wristbandView
{
    if(!_wristbandView)
    {
        UIView *superView = self;
        _wristbandView = [[HomeButtonView alloc]init];
        _wristbandView.iconImageView.image = [UIImage imageNamed:@"icon_cuff"];
        _wristbandView.titleLabel.text = MyNSLocalizedString(@"测辐射手环");
        _wristbandView.layer.cornerRadius = px1920Height(190)/2;
        _wristbandView.backgroundColor = [UIColor whiteColor];
        [superView addSubview:_wristbandView];
    }
    return _wristbandView;
}
- (HomeButtonView *)otherView
{
    if(!_otherView)
    {
        UIView *superView = self;
        _otherView = [[HomeButtonView alloc]init];
        _otherView.iconImageView.image = [UIImage imageNamed:@"icon_product"];
        _otherView.titleLabel.text = MyNSLocalizedString(@"其他产品");
        _otherView.layer.cornerRadius = px1920Height(190)/2;
        _otherView.backgroundColor = [UIColor whiteColor];
        [superView addSubview:_otherView];
    }
    return _otherView;
}


@end
